//////////////////////////////////////////////////////////////////////
// Camera.h
//
// SHEN Fangyang
// me@shenfy.com
//
// Copyright (C) SHEN Fangyang, 2011, All rights reserved.
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////
//  Brief Description
//
//	DXUT CBaseCamera wrapper
//
//////////////////////////////////////////////////////////////////////
#pragma once

namespace grflib
{
	namespace engine
	{
		namespace core
		{
			class CCamera
			{
			public:
				enum MotionType {MOTION_MODELVIEW = 0, MOTION_FIRSTPERSON};

				CCamera(int motionType = MOTION_MODELVIEW);
				~CCamera(void);

				void SetFOV(float fovy, float w = 1.0f /*full window width*/, float h = 1.0f /*full window height*/);
				void SetClipPlanes(float fNear, float fFar);

				HRESULT OnResize(ID3D10Device *pd3dDevice, IDXGISwapChain *pSwapChain, const DXGI_SURFACE_DESC *pBufferSurfaceDesc);
                HRESULT OnResize(UINT width, UINT height);
				LRESULT MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
				void FrameMove(float fElapsedTime);

                bool &AllowInteraction() {return m_isInteractive;}

				CBaseCamera *GetDXUTCamera(void) { return m_pCamera; }

			protected:
				CBaseCamera *m_pCamera;
				float m_fWidthRatio, m_fHeightRatio; //w, h both in [0.0f, 1.0f]
				const int m_motionType;
				float m_fovy;
				float m_fNear, m_fFar;
                bool m_isInteractive;
			};

		} //namespace core
	} //namespace engine
} //namespace grflib